package org.arch_learn.netty_rpc.provider2;

import org.arch_learn.netty_rpc.provider2.netty_server.NettyRpcServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Provider2Application implements CommandLineRunner {
    @Autowired
    private NettyRpcServer nettyRpcServer;

    public static void main(String[] args) {
        SpringApplication.run(Provider2Application.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        new Thread(() -> nettyRpcServer.startServer("127.0.0.1", 9999))
                .start();
    }
}
